package cn.com.lms.business.questionnaire.persistence.repository;

import cn.com.lms.business.questionnaire.persistence.entity.QuestionnaireInfo;

import com.bnzj.core.persistence.repository.BaseRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.Collection;

/**
 * @Author: 16266
 * @DateTime: 2020/3/20 14:13
 * @Description: 问卷信息持久层
 */
@Repository
public interface QuestionnaireInfoRepository extends BaseRepository<QuestionnaireInfo,Long> {

    QuestionnaireInfo findByIdAndIsDeleteEquals(Long id,Boolean isDelete);

    @Transactional
    @Modifying
    @Query(value = "update bnz_questionnaire_info set is_delete =:isDelete WHERE id in (:collection)", nativeQuery = true)
    int updateIsDelete(@Param("isDelete") Boolean isDelete , @Param("collection") Collection<Long> collection) ;
}
